/**
 * 
 */
package us.gaaoc.framework.dao;

import java.util.List;

import org.hibernate.Query;

import us.gaaoc.framework.model.Person;
import us.gaaoc.framework.model.VisualMark;
import us.gaaoc.framework.model.VisualMarkCategory;

/**
 * @author Sukhada Tapshalkar
 *
 * Dec 21, 2007
 *
 * GAJE_BibbCounty_2.0
 *
 * TODO
 */
public class VisualMarkDAOHibernate extends
GenericHibernateDAO<VisualMark, String, VisualMarkDAO> implements
VisualMarkDAO  {

	/* (non-Javadoc)
	 * @see us.gaaoc.framework.dao.VisualMarkDAO#getVisualMark(us.gaaoc.framework.model.Person)
	 */
	public VisualMark getVisualMark(Person personSigner, boolean altSigFlag, VisualMarkCategory visualCategory) {
		Query q = this.getSession().createQuery("from VisualMark visualMark where visualMark.person= ? and visualMark.defaultFlag = ? and" +
				" visualMark.visualMarkCategory = ? ");
		q.setEntity(0, personSigner);
		q.setBoolean(1, altSigFlag );
		q.setEntity(2, visualCategory);
		return (VisualMark)q.uniqueResult();
	}

	/* (non-Javadoc)
	 * @see us.gaaoc.framework.dao.VisualMarkDAO#getVisualMarkList(us.gaaoc.framework.model.Person, boolean)
	 */
	public List<VisualMark> getVisualMarkList(Person personSigner,
			boolean altSigFlag, VisualMarkCategory visualCategory) {
		Query q = this.getSession().createQuery("from VisualMark visualMark where visualMark.person= ? and visualMark.defaultFlag = ? and" +
				" visualMark.visualMarkCategory = ? ");
		q.setEntity(0, personSigner);
		q.setBoolean(1, altSigFlag );
		q.setEntity(2, visualCategory);
		List<VisualMark> list =q.list();
		return list;
	}

}
